<?php
$model=new Model();
$model->select = "id,rate_count, rate_point, rate_average";
$model->getdata('truyen');
$result = $model->fetchAll();

foreach($result as $key => $value){
	$counts = rand(10, 20);
	$average = rand(35,50)/10;
	$points = ceil($average*$counts);
	$data = array('rate_count'	=> $counts, 'rate_point'=>$points, 'rate_average'=>$average);
	$model->where = "id = '" . $value['id'] . "'";
	$model->update('truyen', $data);
}




